﻿using JiveMessenger.ViewModels;
using JmShared;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Data;

namespace JiveMessenger.SampleData
{
    public class SampleViewModelNotifications : IViewModelNotifications
    {
        public void Cleanup()
        {
            throw new NotImplementedException();
        }

        public string AcceptButtonText
        {
            get
            {
                return "Accept";
            }
            set
            {
            }
        }
        public string DeclineButtonText
        {
            get
            {
                return "Decline";
            }
            set
            {
            }
        }
        public bool HaveUnreadNotifications
        {
            get
            {
                return true;
            }
            set
            {
                throw new NotImplementedException();
            }
        }
        private System.Collections.ObjectModel.ObservableCollection<JmShared.NotificationBase> _notifications;
        public System.Collections.ObjectModel.ObservableCollection<JmShared.NotificationBase> Notifications
        {
            get
            {
                if (_notifications == null)
                {
                    _notifications = new System.Collections.ObjectModel.ObservableCollection<JmShared.NotificationBase>();
                    var locator = (ViewModelLocator)Application.Current.Resources["Locator"];
                    _notifications.Add(new FriendInviteNotification() { IsRead = false, NotificationText = "join plx", SenderUsername = locator.CurrentClient.CurrentUserInfo.UserName });
                    _notifications.Add(new GroupInviteNotification() { IsRead = false, Group = locator.CurrentClient.CurrentUserInfo.ChatGroups.FirstOrDefault(), NotificationText = "join gruppe", SenderUsername = locator.CurrentClient.CurrentUserInfo.UserName });
                    ICollectionView view = CollectionViewSource.GetDefaultView(_notifications) as ICollectionView;
                    view.GroupDescriptions.Add(new PropertyGroupDescription("NotificationType"));
                }
                return _notifications;
            }
            set
            {
                throw new NotImplementedException();
            }
        }


        public GalaSoft.MvvmLight.Command.RelayCommand AcceptInviteCommand
        {
            get
            {
                return null;
            }
            set
            {
                throw new NotImplementedException();
            }
        }

        public GalaSoft.MvvmLight.Command.RelayCommand DeclineInviteCommand
        {
            get
            {
                return null;
            }
            set
            {
                throw new NotImplementedException();
            }
        }


        public int NotificationCount
        {
            get
            {
                return this.Notifications != null ? this.Notifications.Count : 0;
            }
        }



    }
}
